
package com.example.sistemacompras;

import com.example.sistemacompras.adapter.BuyListAdapter;
import com.example.sistemacompras.entity.Product;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class HomeActivity extends Activity {

    ListView list;

    BuyListAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        list = (ListView) findViewById(R.id.home_list);

        search(null);

    }

    /**
     * 
     */
    private List<Product> search(View view) {
        // TODO

        List<Product> omes = new ArrayList<Product>();
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));
        // omes.add(new Product(0, 0, "Jo‹o", "", 0, null));

        adapter = new BuyListAdapter(this, R.layout.adapter, omes);

        list.setAdapter(adapter);

        list.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                // TODO
                // Mostra uma mensagem quando o usu‡rio selecionar um item na
                // lista usando o Toast (Tooltip)
                // Toast.makeText(getApplicationContext(),
                // "Voc� selecionou o item " + position + ": " +
                // nomes.get(position), Toast.LENGTH_LONG).show();
            }
        });

        return null;
    }

}
